#include "Shm.hpp"
#include "namedPipe.hpp"
int main()
{

    // 1.创建共享内存
    Shm shm(gpathname, gproj_id, gUser);
    // char *addr = (char *)shm.AttachShm();
    // shm.DetachShm(addr);
    shm.Zero();
    char *shmaddr = (char *)shm.Addr();
    sleep(3);

    // 2.打开管道
    // NamedPipe fifo(comm_path, User);
    // fifo.OpenForWrite();

    // 当成string
    char ch = 'A';
    while (ch <= 'Z')
    {
        shmaddr[ch - 'A'] = ch;
        ch++;
        // std::string temp = "wake up";
        // std::cout << "add " << ch << " into Shm, "
        //           << "wakeup reader" << std::endl;
        // fifo.WriteNamedPipe(temp);
        sleep(2);
        //ch++;
    }

    // key_t key=GetCommKey(gpathname,gproj_id);
    // std::cout<<"key: "<<ToHex(key)<<std::endl;
    // //int shmid=ShmGet(key,4096);
    // //std::cout<<"shmid: "<<shmid<<std::endl;
    return 0;
}